import {
  createRouter,
  createWebHashHistory
} from 'vue-router'
import pinia from '../store'
import { useMenu } from '../store/menu'

import { translate as $t } from "../language/index"
const routes = [
  {
    path: '/home',
    name: 'home',
    component: () => import('../views/homeView/HomeView.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l1')
    },
  },
  {
    path: '/manage',
    name: 'manage',
    component: () => import('../views/houseManage/HouseManage.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l2')
    },
  },
  {
    path: '/map',
    name: 'map',
    component: () => import('../views/mapFindHouse/MapFindHouse.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l3')
    },
  },
  {
    path: '/newHouseRegistration',
    name: 'newHouseRegistration',
    component: () => import('../views/newHouseRegistration/NewHouseRegistration.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l25')
    },
  },
  {
    path: '/add',
    name: 'add',
    component: () => import('../views/addHouse/AddHouse.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l4')
    },
  },
  {
    path: '/addNewHouse',
    name: 'addNewHouse',
    component: () => import('../views/addNewHouse/AddNewHouse.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l24')
    },
  },
  {
    path: '/detail',
    name: 'detail',
    component: () => import('../views/houseDetail/HouseDetail.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l5')
    },
  },
  {
    path: '/newHouseDetail',
    name: 'newHouseDetail',
    component: () => import('../views/newHouseDetail/NewHouseDetail.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l23')
    },
  },
  {
    path: '/customManage',
    name: 'customManage',
    component: () => import('../views/customManage/CustomManage.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l6')
    },
  },
  {
    path: '/addCustom',
    name: 'adaddCustomd',
    component: () => import('../views/addCustom/AddCustom.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l7')
    },
  },
  {
    path: '/customDetail',
    name: 'customDetail',
    component: () => import('../views/customDetail/CustomDetail.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l8')
    },
  },

  {
    path: '/realEstate',
    name: 'realEstate',
    component: () => import('../views/realEstate/RealEstate.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l11')
    },
  },
  {
    path: '/regionManage',
    name: 'regionManage',
    component: () => import('../views/regionManage/RegionManage.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l10')
    },
  },
  {
    path: '/addNeighbourhoods',
    name: 'addNeighbourhoods',
    component: () => import('../views/addNeighbourhoods/AddNeighbourhoods.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l12')
    },
  },
  {
    path: '/neighbourhoodsDetail',
    name: 'neighbourhoodsDetail',
    component: () => import('../views/neighbourhoodsDetail/NeighbourhoodsDetail.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l13')
    },
  },
  {
    path: '/personnelManage',
    name: 'personnelManage',
    component: () => import('../views/personnelManage/PersonnelManage.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l14')
    },
  },
  {
    path: '/department',
    name: 'department',
    component: () => import('../views/department/DepartmentView.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l15')
    },
  },
  {
    path: '/employeeManage',
    name: 'employeeManage',
    component: () => import('../views/employeeManage/EmployeeManage.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l16')
    },
  },
  {
    path: '/addEmployees',
    name: 'addEmployees',
    component: () => import('../views/addEmployees/AddEmployees.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l17')
    },
  },
  {
    path: '/employeeDetails',
    name: 'employeeDetails',
    component: () => import('../views/employeeDetails/EmployeeDetails.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l18')
    },
  },
  {
    path: '/employeeDynamics',
    name: 'employeeDynamics',
    component: () => import('../views/employeeDynamics/EmployeeDynamics.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l19')
    },
  },
  {
    path: '/employeeCare',
    name: 'employeeCare',
    component: () => import('../views/employeeCare/EmployeeCare.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l20')
    },
  },
  {
    path: '/loginLog',
    name: 'loginLog',
    component: () => import('../views/loginLog/LoginLog.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l21')
    },
  },
  {
    path: '/systemSetting',
    name: 'systemSetting',
    component: () => import('../views/systemSetting/SystemSetting.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l22')
    },
  },

  {
    path: '/transactionContract',
    name: 'transactionContract',
    component: () => import('../views/transactionContract/TransactionContract.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l26')
    },
  },
  {
    path: '/contractManage',
    name: 'contractManage',
    component: () => import('../views/contractManage/ContractManage.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l27')
    },
  },

  {
    path: '/addContract',
    name: 'addContract',
    component: () => import('../views/addContract/AddContract.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l28')
    },
  },

  {
    path: '/contractDetail',
    name: 'contractDetail',
    component: () => import('../views/contractDetail/ContractDetail.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l29')
    },
  },
  {
    path: '/collectionRecords',
    name: 'collectionRecords',
    component: () => import('../views/collectionRecords/CollectionRecords.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l32')
    },
  },
  {
    path: '/transactionProgress',
    name: 'transactionProgress',
    component: () => import('../views/transactionProgress/TransactionProgress.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l33')
    },
  },

  {
    path: '/transactionTemplate',
    name: 'transactionTemplate',
    component: () => import('../views/transactionTemplate/TransactionTemplate.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l34')
    },
  },
  {
    path: '/financialManage',
    name: 'financialManage',
    component: () => import('../views/financialManage/FinancialManage.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l35')
    },
  },

  {
    path: '/storeFees',
    name: 'storeFees',
    component: () => import('../views/storeFees/StoreFees.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l36')
    },
  },
  {
    path: '/employeeRewards',
    name: 'employeeRewards',
    component: () => import('../views/employeeRewards/EmployeeRewards.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l37')
    },
  },
  {
    path: '/payrollManage',
    name: 'payrollManage',
    component: () => import('../views/payrollManage/PayrollManage.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l38')
    },
  },
  {
    path: '/financialStatements',
    name: 'financialStatements',
    component: () => import('../views/financialStatements/FinancialStatements.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l39')
    },
  },
  {
    path: '/salaryConfiguration',
    name: 'salaryConfiguration',
    component: () => import('../views/salaryConfiguration/SalaryConfiguration.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l40')
    },
  },
  {
    path: '/commissionPlan',
    name: 'commissionPlan',
    component: () => import('../views/commissionPlan/CommissionPlan.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l41')
    },
  },
  {
    path: '/realEstateInformation',
    name: 'realEstateInformation',
    component: () => import('../views/realEstateInformation/RealEstateInformation.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l42')
    },
  },
  {
    path: '/addInformation',
    name: 'addInformation',
    component: () => import('../views/addInformation/AddInformation.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l43')
    },
  },
  {
    path: '/editInformation',
    name: 'editInformation',
    component: () => import('../views/editInformation/EditInformation.vue'),
    meta: {
      hidden: false,
      name: $t('text.router.l44')
    },
  },
  {
    path: '/personalCenter',
    name: 'personalCenter',
    component: () => import('../views/personalCenter/PersonalCenter.vue'),
    meta: {
      hidden: false,
      name: $t('text.System.a96')
    },
  },
  {
    path: '/myReminder',
    name: 'myReminder',
    component: () => import('../views/myReminder/MyReminder.vue'),
    meta: {
      hidden: false,
      name: $t('text.Message.l1')
    },
  },
  {
    path: '/announcementNotice',
    name: 'announcementNotice',
    component: () => import('../views/announcementNotice/AnnouncementNotice.vue'),
    meta: {
      hidden: false,
      name: $t('text.Message.l2')
    },
  },



  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/MyLogin.vue'),
    meta: {
      hidden: true,
      name: $t('text.router.l9')
    },
  },
  {
    path: '/',
    redirect: '/home',
    name: 'RoutingMount',
    meta: {
      hidden: true,
      name: 'house',
    }
  },
  {
    path: '/404',
    name: '404',
    component: () => import('../views/404/NotFound.vue'),
    meta: {
      hidden: true,
      name: '404'
    },
  },
  {
    path: '/:pathMatch(.*)*',
    component: () => import('../views/404/NotFound.vue'),
    meta: {
      hidden: true,
    },
  },
]

const menu = useMenu(pinia)
menu.routes = routes.filter((v) => v.meta.hidden === false)
menu.activeIndex = routes.filter((v) => v.meta.hidden === false)[0].path

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
